package com.ting.etp.loader.config;

import com.ting.etp.common.exception.EtpException;
import com.ting.etp.loader.enums.DevelopmentModeEnum;

public class DevelopmentModeConfig {
    private static DevelopmentModeEnum developmentMode;

    public static void setDevelopmentMode(DevelopmentModeEnum developmentMode) {
        if (DevelopmentModeConfig.developmentMode == null){
            DevelopmentModeConfig.developmentMode = DevelopmentModeEnum.checkModeKey(developmentMode);
        }else {
            throw new EtpException("开发模式只能系统初始化时设置，请实现该方法com.ting.etp.loader.start.EtpStart.developmentMode");
        }
    }

    public static boolean isolation(){
        return DevelopmentModeEnum.ISOLATION.equals(developmentMode);
    }

    public static boolean coexist(){
        return DevelopmentModeEnum.COEXIST.equals(developmentMode);
    }

    public static DevelopmentModeEnum getDevelopmentMode(){
        return developmentMode;
    }

}
